package org.itstep.stepup.webui.controllers;

import org.itstep.stepup.dal.entities.Test;
import org.itstep.stepup.dal.infrastructure.SessionFactoryUtil;
import org.itstep.stepup.dal.repositories.TestRepository;
import org.itstep.stepup.dal.repositories.impl.TestRepositoryImpl;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


@Controller
@RequestMapping("/Index")
public class IndexController{
 
   @RequestMapping(method = RequestMethod.GET)
   public String index(ModelMap model) { 
	  TestRepository testRepository = new TestRepositoryImpl(SessionFactoryUtil.getInstance());
	  Test test = testRepository.getById(1);
      model.addAttribute("hello", test.getMessage());
      return "Index";	   
   }


}